# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/10/27 18:00
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : sharp_im1.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
from PIL import ImageFilter, Image
import numpy as np
from DIP_experiment_5.util import contrast_show

# 以灰度图形式读入图像
im_path = "../experiment_fig/beans.png"
font_path = "C:/Windows/Fonts/simhei.ttf"
im = Image.open(im_path)
gaussion_blur_im = np.array(im.filter(ImageFilter.GaussianBlur))
im_array = np.array(im)
im_dict = {}
for num in range(1, 9):
    num = 1 << num
    sharp_im = im_array + (im_array - gaussion_blur_im) * num
    im_dict["总数" + str(num)] = sharp_im
contrast_show(im_dict, (2, 4),wspace=0.4, font=font_path)
